<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>css3绘制八卦图及动画效果</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        .box {
            margin: 100px auto;
            width: 400px;
            height:400px;
            border-radius:200px;
            box-shadow:0 0 10px #999;
            position:relative;
            animation:circleRotate 3s linear 2s infinite;
        }
        .semi-circle{
            height:400px;
            width:200px;
        }
        .box .left{
            background:#000;
            border-top-left-radius:200px;
            border-bottom-left-radius:200px;
        }

        .box .right{
            background:#fff;
            border-top-left-radius:200px;
            border-bottom-left-radius:200px;
        }
        .box .top-circle{
            position:absolute;
            left:100px;
            top:0;
            height:200px;
            width:200px;
            text-align:center;
            line-height:200px;
            border-radius:100px;
            background:#000;
        }
        .box .bottom-circle{
            position:absolute;
            left:100px;
            bottom:0;
            height:200px;
            width:200px;
            text-align:center;
            line-height:200px;
            border-radius:100px;
            background:#fff;
        }
        .box .small-circle{
            display:inline-block;
            height:40px;
            width:40px;
            border-radius:20px;
            background:red;
        }
        .box .white{background:#fff;}
        .box .black{background:#000;}
        @keyframes circleRotate{
        %0{
            transform:rotate(0deg);
        }
        100%{
            transform:rotate(360deg);
        }
        }
    </style>
</head>

<body>
<div class="box">
    <div class="semi-circle left"></div>
    <div class="semi-circle right"></div>
    <div class="top-circle">
        <span class="small-circle white"></span>
    </div>
    <div class="bottom-circle">
        <span class="small-circle black"></span>
    </div>
</div>
</body>

</html>